Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Collections.Generic
Imports facebook.web
Imports System.Web.Configuration
Imports facebook
Imports facebook.Schema
Imports facebook.Utility

Namespace FBMLSample.handlers
	Partial Public Class jsFeed
		Inherits CanvasFBMLBasePage
		Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs)
			Me.RequireLogin = True
		End Sub
		Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
			If (Not String.IsNullOrEmpty(Request.Params("picked"))) Then
				Dim picked = Integer.Parse(Request.Params("picked"))
				Dim moodList = JSONHelper.ConvertFromJSONArray(Me.API.data.getUserPreference(0))
				moodList.Insert(0, picked.ToString())
				Me.API.data.setUserPreference(0, JSONHelper.ConvertToJSONArray(moodList))
				Dim oldCount = 0
				If (Not String.IsNullOrEmpty(Me.API.data.getUserPreference(2))) Then
					oldCount = Integer.Parse(Me.API.data.getUserPreference(2))
				End If
				Me.API.data.setUserPreference(2, (oldCount + 1).ToString())
			End If
		End Sub
	End Class
End Namespace
